
import {
    DesktopOutlined,
    // FileOutlined,
    PieChartOutlined,
    TeamOutlined,
    UserOutlined,
} from '@ant-design/icons';

import Login from "../page/login/Login";
import Home from "../page/home/Home";
import My from "../page/my/My";
import Index from "../page/index/Index";
import I18 from '../page/i18/I18';
import { lazy } from 'react';

let Zy = lazy(() => import('../page/i18/zy/Zy'))
// let Listt = lazy(() => import('../page/List/Listt'))
let Inlist = lazy(() => import('../page/inlist/Inlist'))
let Yd = lazy(() => import('../page/i18/yd/Yd'))
let Hf = lazy(() => import('../page/hf/hf'))
let Editll = lazy(() => import('../page/editll/Editll'))
let Sx=lazy(()=>import('../page/sx/Sx'))
let Sjz=lazy(()=>import('../page/Sjz/Sjz'))
export let homerouter: any = [

]

let allRouter: any = {
    index: {
        path: '/',
        element: <Index />,
        title: '首页',
        icon: <DesktopOutlined />
    },
    my: {
        path: '/my',
        element: <My />,
        title: '我的',
        icon: <UserOutlined />
    },
    // listt: {
    //     path: '/listt',
    //     element: <Listt />,
    //     title: '无限列表',
    //     icon: <UserOutlined />
    // },
     inlist: {
        path: '/inlist',
        element: <Inlist />,
        title: '无限列表',
        icon: <UserOutlined />
    },
    editll: {
        path: '/editll/:id',
        element: <Editll />,
        title: '详情',
        icon: <UserOutlined />
    },
    hf: {
        path: '/hf',
        element: <Hf />,
        title: '换肤',
        icon: <UserOutlined />
    },
     sjz: {
        path: '/sjz',
        element: <Sjz />,
        title: '时间轴',
        icon: <UserOutlined />
    },
      yd: {
        path: '/yd',
        element: <Yd/>,
        title: '有道',
        icon: <UserOutlined />
    },
     sx: {
        path: '/sx',
        element: <Sx/>,
        title: '树形',
        icon: <UserOutlined />
    },
    i18: {
        path: '/i18',
        element: <I18 />,
        title: '翻译',
        icon: <PieChartOutlined />,
        children: [
            {
                path: '/i18/zy',
                element: <Zy />,
                title: '中英文',
                icon: <TeamOutlined />,
            },
            {
                path: '/i18/yd',
                element: <Yd />,
                title: '有道翻译',
                icon: <UserOutlined />,
            }
        ]
    },
}

const role = {
    admin: {
        routerr: ['index', 'i18', 'hf', 'my', 'editll', 'yd','inlist','sx']
    },
    user: {
        routerr: ['index', 'hf', 'my', 'editll']
    }
}
let {routerr}=role[localStorage.getItem('role')=='1'?'admin':'user']
routerr.forEach((item)=>{
    homerouter.push(allRouter[item])
})
let router = [
    {
        path: '/',
        element: <Home />,
        children: homerouter
    },
    {
        path: '/login',
        element: <Login />,

    },
]
export default router